#include "pincfg.h"
#include "nand_w25n.h"
#include "bsp_spi_nor.h"

/*init spi interface*/
void nand_spi_init(void)
{
}

/*chip select control*/
void nand_spi_cs(uint8_t vol)
{
    if (vol)
        nand_ss.en();
    else
        nand_ss.dis();
}

/*switch to spi or qpi*/
void nand_spi_mode_spi(void){}
void nand_spi_mode_qpi_out(void){}
void nand_spi_mode_qpi_in(void){}

/*read and write 1 bype*/
uint8_t nand_spi_rb(void)
{
    return nor_spi_rb();
}

void nand_spi_wb(uint8_t wdata)
{
    nor_spi_wb(wdata);
}

/*read n bytes*/
uint8_t nand_spi_read(uint8_t *prd, uint16_t len)
{
    return nor_spi_read(prd, len);
}

/*write n bytes*/
uint8_t nand_spi_cmd_send(const uint8_t *pwd, uint16_t len)
{
    return nor_spi_cmd_send(pwd, len);
}

/*write n bytes*/
uint8_t nand_spi_write(const uint8_t *pwd, uint16_t len)
{
    return nor_spi_write(pwd, len);
}

/*read n bytes*/
uint8_t nand_qpi_read(uint8_t *prd, uint16_t len)
{
    return nor_spi_read(prd, len);
}

/*write n bytes*/
uint8_t nand_qpi_write(const uint8_t *pwd, uint16_t len)
{
    return nor_spi_write(pwd, len);
}
